package com.mongodb.demo;

import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhangbowen@heytea.com
 * @since 2020-01-02 09:33
 */
@RestController
@Api
public class TestController {

    @Autowired
    private MongoTemplate mongoTemplate;


    @PostMapping("test")
    public MapData test(@RequestBody MapData mapData){
        return mongoTemplate.insert(mapData);
    }
}
